package com.ys.service.business.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ys.entity.account.TcwAdvanceAccountBack;
import com.ys.entity.account.TcwAdvanceAccountRecharge;
import com.ys.entity.account.TcwAdvanceAccountReimbursement;
import com.ys.entity.administration.AdmUseSignetApply;
import com.ys.entity.base.*;
import com.ys.entity.business.*;
import com.ys.entity.finance.*;
import com.ys.entity.hr.*;
import com.ys.entity.logistics.TlCustomsDeclaration;
import com.ys.entity.purchase.TcgInvoiceOffset;
import com.ys.entity.purchase.TcgPurchaseAppointOrder;
import com.ys.entity.purchase.TcgPurchaseByPlan;
import com.ys.entity.storage.TccAllocate;
import com.ys.entity.storage.TccAllocateCancel;
import com.ys.entity.storage.TccDistribute;
import com.ys.service.account.TcwAdvanceAccountBackService;
import com.ys.service.account.TcwAdvanceAccountRechargeService;
import com.ys.service.account.TcwAdvanceAccountReimbursementService;
import com.ys.service.account.TcwNeedPayAccountPayService;
import com.ys.service.administration.AdmUseSignetApplyService;
import com.ys.service.base.*;
import com.ys.service.business.*;
import com.ys.service.finance.*;
import com.ys.service.flow.YspTaskService;
import com.ys.service.hr.*;
import com.ys.service.logistics.TlCustomsDeclarationService;
import com.ys.service.purchase.*;
import com.ys.service.storage.TccAllocateCancelService;
import com.ys.service.storage.TccAllocateService;
import com.ys.service.storage.TccDistributeService;
import com.ys.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ys.config.MenuId;

@Service("taskService")
public class TaskServiceImpl implements TaskService {
	@Autowired
	private YspTaskService yspTaskService;

	@Autowired
	private ThrTransparencyProgramService thrTransparencyProgramService;
	@Autowired
	private ThrVatApplyService thrVatApplyService;
	@Autowired
	private TcwWanliOtherPaymentService tcwWanliOtherPaymentService;
	@Autowired
	private TcwWanliPaymentReturnService tcwWanliPaymentReturnService;
	@Autowired
	private TcwCompanyAccountTransferService tcwCompanyAccountTransferService;
	@Autowired
	private TcwEntryApplyService tcwEntryApplyService;
	@Autowired
	private TcwNeedPayAccountPayService tcwNeedPayAccountPayService;
	@Autowired
	private ThrOperateCompanyBeianService thrOperateCompanyBeianService;
	@Autowired
	private TcgPurchaseByPlanService tcgPurchasePlanService;
	@Autowired
	private TlCustomsDeclarationService tlCustomsDeclarationService;
	@Autowired
	private TcwExpenseSettlementService tcwExpenseSettlementService;
	@Autowired
	private TcwExpenseAllocationService tcwExpenseAllocationService;
	@Autowired
	private TcgInvoiceRegistService tcgInvoiceRegistService;
	@Autowired
	private TcgInvoiceOffsetService tcgInvoiceOffsetService;
	@Autowired
	private TcgPurchasePaymentService tcgPurchasePaymentService;
	@Autowired
	private TcgPurchaseAppointOrderService tcgPurchaseAppointOrderService;
	@Autowired
	private TcgPurchasePreStorageService tcgPurchasePreStorageService;
	@Autowired
	private TcgPurchaseContractService tcgPurchaseContractService;
	@Autowired
	private TcwExpenseSettleReturnService tcwExpenseSettleReturnService;
	@Autowired
	private TcwPaymentApplyService tcwPaymentApplyService;
	@Autowired
	private TcwRoleCostApplyService tcwRoleCostApplyService;
	@Autowired
	private TcwWanliReconciliationService tcwWanliReconciliationService;
	@Autowired
	private TcwWanliSupplementaryService tcwWanliSupplementaryService;
	@Autowired
	private TcwWanliPrepaymentRecordedService tcwWanliPrepaymentRecordedService;
	@Autowired
	private TcwWanliCnyPaymentService tcwWanliCnyPaymentService;
	@Autowired
	private TcwPaymentReturnService tcwPaymentReturnService;
	@Autowired
	private TcwWanliDrawingService tcwWanliDrawingService;
	@Autowired
	private TcwWanliCurrencyExchangeService tcwWanliCurrencyExchangeService;
	@Autowired
	private TcwCapitalClaimService tcwCapitalClaimService;
	@Autowired
	private TcwCapitalBusinessCostService tcwCapitalBusinessCostService;
	@Autowired
	private TcwCapitalRegisterService tcwCapitalRegisterService;
	@Autowired
	private TwlStockBorrowService twlStockBorrowService;
	@Autowired
	private TcwAdvanceAccountReimbursementService tcwAdvanceAccountReimbursementService;
	@Autowired
	private TcwAdvanceAccountRechargeService tcwAdvanceAccountRechargeService;
	@Autowired
	private TcwAdvanceAccountBackService tcwAdvanceAccountBackService;
	@Autowired
	private TwlStockTransferService twlStockTransferService;
	@Autowired
	private TbIncomePayService tbIncomePayService;
	@Autowired
	private TbReservedPayService tbReservedPayService;
	@Autowired
	private TbSocialSecurityPayService tbSocialSecurityPayService;
	@Autowired
	private TbMedicarePayService tbMedicarePayService;
	@Autowired
	private TbPayrollSlipService tbPayrollSlipService;
	@Autowired
	private TbUserPayApplyService tbUserPayApplyService;
	@Autowired
	private TwlStockOutService twlStockOutService;
	@Autowired
	private TbUserMonthPerformanceReportService tbUserMonthPerformanceReportService;
	@Autowired
	private TwlStockInService twlStockInService;
	@Autowired
	private ThrCanvassApplyService thrCanvassApplyService;
	@Autowired
	private TccAllocateCancelService tccAllocateCancelService;
	@Autowired
	private TccDistributeService tccDistributeService;
	@Autowired
	private ThrUserEntryApplyService thrUserEntryApplyService;
	@Autowired
	private TpProductBqService tpProductBqService;
	@Autowired
	private TccAllocateService tccAllocateService;
	@Autowired
	private TpProductActiveSqService tpProductActiveSqService;
	@Autowired
	private TpAplusSqService tpAplusSqService;
	@Autowired
	private AdmUseSignetApplyService admUseSignetApplyService;
	@Autowired
	private TcwRunningBackService tcwRunningBackService;
	@Autowired
	private TcwExpenseAllocationByManageService tcwExpenseAllocationByManageService;

	/**
	 * 审批通过
	 */
	@Override
	public R taskFlowPass(Long menuId, String userId, String bid) throws Exception{
		R r = R.ok();
		/*
		 * 根据不同菜单ID，流转不同单据
		 */
		if (menuId == MenuId.THR_OperateCompanyBeian.longValue()) {// 运营公司备案
			ThrOperateCompanyBeian entity = new ThrOperateCompanyBeian().setBid(bid).queryFirst();
			r = thrOperateCompanyBeianService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_RunningBack.longValue()) {// 费用返还单
			TcwRunningBack entity = new TcwRunningBack().setBid(bid).queryFirst();
			r = tcwRunningBackService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.ADM_UseSignetApply.longValue()) {// 用章申请单
			AdmUseSignetApply entity = new AdmUseSignetApply().setBid(bid).queryFirst();
			r = admUseSignetApplyService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TP_AplusSq.longValue()) {// A+申请
			TpAplusSq entity = new TpAplusSq().setBid(bid).queryFirst();
			r = tpAplusSqService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TP_ProductActiveSq.longValue()) {// Listing申请
			TpProductActiveSq entity = new TpProductActiveSq().setBid(bid).queryFirst();
			r = tpProductActiveSqService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCC_Allocate.longValue()) {// 预约调拨单
			TccAllocate entity = new TccAllocate().setBid(bid).queryFirst();
			r = tccAllocateService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TP_ProductBq.longValue()) {// 商品备案申请
			TpProductBq entity = new TpProductBq().setBid(bid).queryFirst();
			r = tpProductBqService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.THR_UserEntryApply.longValue()) {// 员工入职申请
			ThrUserEntryApply entity = new ThrUserEntryApply().setBid(bid).queryFirst();
			r = thrUserEntryApplyService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCC_Distribute.longValue()) {// 手工分配单
			TccDistribute entity = new TccDistribute().setBid(bid).queryFirst();
			r = tccDistributeService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCC_AllocateCancel.longValue()) {// 预约调拨取消单
			TccAllocateCancel entity = new TccAllocateCancel().setBid(bid).queryFirst();
			r = tccAllocateCancelService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.THR_CanvassApply.longValue()) {// 招商信息申请
			ThrCanvassApply entity = new ThrCanvassApply().setBid(bid).queryFirst();
			r = thrCanvassApplyService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TWL_StockIn.longValue()) {// 物料入库单
			r = twlStockInService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.THR_TransparencyProgram.longValue()) {// 透明计划申报
			r = thrTransparencyProgramService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TB_UserMonthPerformanceReport.longValue()) {// 员工月度绩效申报
			TbUserMonthPerformanceReport entity = new TbUserMonthPerformanceReport().setBid(bid).queryFirst();
			r = tbUserMonthPerformanceReportService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TWL_StockOut.longValue()) {// 物料出库单
			TwlStockOut entity = new TwlStockOut().setBid(bid).queryFirst();
			r = twlStockOutService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TB_UserPayApply.longValue()) {// 员工工资申请单
			TbUserPayApply entity = new TbUserPayApply().setBid(bid).queryFirst();
			r = tbUserPayApplyService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TB_PayrollSlip.longValue()) {// 工资付款单
			TbPayrollSlip entity = new TbPayrollSlip().setBid(bid).queryFirst();
			r = tbPayrollSlipService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TB_MedicarePay.longValue()) {// 医保付款单
			TbMedicarePay entity = new TbMedicarePay().setBid(bid).queryFirst();
			r = tbMedicarePayService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TB_SocialSecurityPay.longValue()) {// 社保付款单
			TbSocialSecurityPay entity = new TbSocialSecurityPay().setBid(bid).queryFirst();
			r = tbSocialSecurityPayService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TB_ReservedPay.longValue()) {// 公积金付款单
			TbReservedPay entity = new TbReservedPay().setBid(bid).queryFirst();
			r = tbReservedPayService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TB_IncomePay.longValue()) {// 个税付款单
			TbIncomePay entity = new TbIncomePay().setBid(bid).queryFirst();
			r = tbIncomePayService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.THR_VatApply.longValue()) {// VAT申报
			r = thrVatApplyService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TWL_StockTransfer.longValue()) {// 物料转移单
			TwlStockTransfer entity = new TwlStockTransfer().setBid(bid).queryFirst();
			r = twlStockTransferService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountBack.longValue()) {// 预支账户归还单
			TcwAdvanceAccountBack entity = new TcwAdvanceAccountBack().setBid(bid).queryFirst();
			r = tcwAdvanceAccountBackService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountRecharge.longValue()) {// 预支账户充值单
			TcwAdvanceAccountRecharge entity = new TcwAdvanceAccountRecharge().setBid(bid).queryFirst();
			r = tcwAdvanceAccountRechargeService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountReimbursement.longValue()) {// 预支账户报销单
			TcwAdvanceAccountReimbursement entity = new TcwAdvanceAccountReimbursement().setBid(bid).queryFirst();
			r = tcwAdvanceAccountReimbursementService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TWL_StockBorrow.longValue()) {// 物料借用单
			r = twlStockBorrowService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_CapitalRegister.longValue()) {// 资金登记单
			TcwCapitalRegister entity = new TcwCapitalRegister().setBid(bid).queryFirst();
			r = tcwCapitalRegisterService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_CapitalBusinessCost.longValue()) {// 预付款认领单
			TcwCapitalBusinessCost entity = new TcwCapitalBusinessCost().setBid(bid).queryFirst();
			r = tcwCapitalBusinessCostService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_CapitalClaim.longValue()) {// 资金认领单
			TcwCapitalClaim entity = new TcwCapitalClaim().setBid(bid).queryFirst();
			r = tcwCapitalClaimService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_WanliCurrencyExchange.longValue()) {// 万里汇货币兑换单
			TcwWanliCurrencyExchange entity = new TcwWanliCurrencyExchange().setBid(bid).queryFirst();
			r = tcwWanliCurrencyExchangeService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_WanliDrawing.longValue()) {// 万里汇提款单
			TcwWanliDrawing entity = new TcwWanliDrawing().setBid(bid).queryFirst();
			r = tcwWanliDrawingService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_PaymentReturn.longValue()) {// 预付款退回申请
			TcwPaymentReturn entity = new TcwPaymentReturn().setBid(bid).queryFirst();
			r = tcwPaymentReturnService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_WanliCnyPayment.longValue()) {// 万里汇CNY付款单
			r = tcwWanliCnyPaymentService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_WanliOtherPayment.longValue()) {// 万里汇外币付款单
			r = tcwWanliOtherPaymentService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_WanliPaymentReturn.longValue()) {//万里汇预付款退回
			TcwWanliPaymentReturn entity = new TcwWanliPaymentReturn().setBid(bid).queryFirst();
			r = tcwWanliPaymentReturnService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_CompanyAccountTransfer.longValue()) {// 公司账户资金转账
			r = tcwCompanyAccountTransferService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_EntryApply.longValue()) {//入账申请单
			TcwEntryApply entity = new TcwEntryApply().setBid(bid).queryFirst();
			r = tcwEntryApplyService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_WanliPrepaymentRecorded.longValue()) {//万里汇预付款入账单
			TcwWanliPrepaymentRecorded entity = new TcwWanliPrepaymentRecorded().setBid(bid).queryFirst();
			r = tcwWanliPrepaymentRecordedService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_WanliSupplementary.longValue()) {//万里汇补账单
			r = tcwWanliSupplementaryService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_WanliReconciliation.longValue()) {//万里汇预付款对账单
			r = tcwWanliReconciliationService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_RoleCostApply.longValue()) {//职能费用申请
			r = tcwRoleCostApplyService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_PaymentApply.longValue()) {//付款申请单
			TcwPaymentApply entity = new TcwPaymentApply().setBid(bid).queryFirst();
			r = tcwPaymentApplyService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_ExpenseSettleReturn.longValue()) {//费用结算返还单
			TcwExpenseSettleReturn entity = new TcwExpenseSettleReturn().setBid(bid).queryFirst();
			r = tcwExpenseSettleReturnService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_NeedPayAccountPay.longValue()) {//应付账户支付
			r = tcwNeedPayAccountPayService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseContract.longValue()) {//采购合同单
			r = tcgPurchaseContractService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCG_PurchasePreStorage.longValue()) {//采购预入库
			r = tcgPurchasePreStorageService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseAppointOrder.longValue()) {//预约采购单
			TcgPurchaseAppointOrder entity = new TcgPurchaseAppointOrder().setBid(bid).queryFirst();
			r = tcgPurchaseAppointOrderService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCG_PurchasePayment.longValue()) {//采购付款单
			r = tcgPurchasePaymentService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCG_InvoiceOffset.longValue()) {//发票预核销单
			TcgInvoiceOffset entity = new TcgInvoiceOffset().setBid(bid).queryFirst();
			r = tcgInvoiceOffsetService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCG_InvoiceRegist.longValue()) {//发票登记单
			r = tcgInvoiceRegistService.flowPass(bid, userId);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation.longValue()) {//费用划拨单
			TcwExpenseAllocation entity = new TcwExpenseAllocation().setBid(bid).queryFirst();
			r = tcwExpenseAllocationService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_ExpenseSettlement.longValue()) {//费用结算单
			TcwExpenseSettlement entity = new TcwExpenseSettlement().setBid(bid).queryFirst();
			r = tcwExpenseSettlementService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TL_CustomsDeclaration.longValue()) {//报关单
			TlCustomsDeclaration entity = new TlCustomsDeclaration().setBid(bid).queryFirst();
			r = tlCustomsDeclarationService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCG_PurchaseByPlan.longValue()) {//采购计划单
			TcgPurchaseByPlan entity = new TcgPurchaseByPlan().setBid(bid).queryFirst();
			r = tcgPurchasePlanService.flowPass(entity.getId(), userId);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation_ByManage.longValue()) {//费用划拨单（管理）
			TcwExpenseAllocationByManage entity=new TcwExpenseAllocationByManage().setBid(bid).queryFirst();
			r = tcwExpenseAllocationByManageService.flowPass(entity.getId(), userId);
		}
		else {
			r = R.error("手机端尚未配置该单据");
		}
		return r;
	}


	/**
	 * 审核退回
	 */
	@Override
	public R taskFlowRefuse(Long menuId,String userId,String bid, String reason) throws Exception{
		R r = R.ok();
		/*
		 * 根据不同菜单ID，退回不同单据
		 */
		if (menuId == MenuId.THR_OperateCompanyBeian.longValue()) {// 运营公司备案
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_RunningBack.longValue()) {// 费用返还单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.ADM_UseSignetApply.longValue()) {// 用章申请单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TP_AplusSq.longValue()) {// A+申请
			TpAplusSq entity = new TpAplusSq().setBid(bid).queryFirst();
			r = tpAplusSqService.flowRefuse(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TP_ProductActiveSq.longValue()) {// Listing申请
			TpProductActiveSq entity = new TpProductActiveSq().setBid(bid).queryFirst();
			r = tpProductActiveSqService.flowRefuse(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TCC_Allocate.longValue()) {// 预约调拨单
			TccAllocate entity = new TccAllocate().setBid(bid).queryFirst();
			r = tccAllocateService.flowRefuse(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TP_ProductBq.longValue()) {// 商品备案申请
			TpProductBq entity = new TpProductBq().setBid(bid).queryFirst();
			r = tpProductBqService.flowRefuse(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.THR_UserEntryApply.longValue()) {// 员工入职申请
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCC_Distribute.longValue()) {// 手工分配单
			TccDistribute entity = new TccDistribute().setBid(bid).queryFirst();
			r = tccDistributeService.flowRefuse(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TCC_AllocateCancel.longValue()) {// 预约调拨取消单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.THR_CanvassApply.longValue()) {// 招商信息申请
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockIn.longValue()) {// 物料入库单
			r = twlStockInService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.THR_TransparencyProgram.longValue()) {// 透明计划申报
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TB_UserMonthPerformanceReport.longValue()) {// 员工月度绩效申报
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockOut.longValue()) {// 物料出库单
			TwlStockOut entity = new TwlStockOut().setBid(bid).queryFirst();
			r = twlStockOutService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_UserPayApply.longValue()) {// 员工工资申请单
			TbUserPayApply entity = new TbUserPayApply().setBid(bid).queryFirst();
			r = tbUserPayApplyService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_PayrollSlip.longValue()) {// 工资付款单
			TbPayrollSlip entity = new TbPayrollSlip().setBid(bid).queryFirst();
			r = tbPayrollSlipService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_MedicarePay.longValue()) {// 医保付款单
			TbMedicarePay entity = new TbMedicarePay().setBid(bid).queryFirst();
			r = tbMedicarePayService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_SocialSecurityPay.longValue()) {// 社保付款单
			TbSocialSecurityPay entity = new TbSocialSecurityPay().setBid(bid).queryFirst();
			r = tbSocialSecurityPayService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_ReservedPay.longValue()) {// 公积金付款单
			TbReservedPay entity = new TbReservedPay().setBid(bid).queryFirst();
			r = tbReservedPayService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_IncomePay.longValue()) {// 个税付款单
			TbIncomePay entity = new TbIncomePay().setBid(bid).queryFirst();
			r = tbIncomePayService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.THR_VatApply.longValue()) {// VAT申报
			r = thrVatApplyService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockTransfer.longValue()) {// 物料转移单
			r = twlStockTransferService.flowRefuse(bid, reason,userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountBack.longValue()) {// 预支账户归还单
			TcwAdvanceAccountBack entity = new TcwAdvanceAccountBack().setBid(bid).queryFirst();
			r = tcwAdvanceAccountBackService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountRecharge.longValue()) {// 预支账户充值单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountReimbursement.longValue()) {// 预支账户报销单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockBorrow.longValue()) {// 物料借用单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_CapitalRegister.longValue()) {// 资金登记单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_CapitalBusinessCost.longValue()) {// 预付款认领单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_CapitalClaim.longValue()) {// 资金认领单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliCurrencyExchange.longValue()) {// 万里汇货币兑换单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliDrawing.longValue()) {// 万里汇提款单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_PaymentReturn.longValue()) {// 预付款退回申请
			TcwPaymentReturn entity = new TcwPaymentReturn().setBid(bid).queryFirst();
			r = tcwPaymentReturnService.flowRefuse(entity.getId(),  reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliCnyPayment.longValue()) {// 万里汇CNY付款单
			r = tcwWanliCnyPaymentService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliOtherPayment.longValue()) {// 万里汇外币付款单
			r = tcwWanliOtherPaymentService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliPaymentReturn.longValue()) {//万里汇预付款退回
			//是否有支付过的数据 不允许回退
			if (new TcwWanliPaymentReturnItem().setWanliPaymentReturnBid(bid).where("A.statePay = 1 OR A.statePay = 2").count() != 0){
				r = R.error("数据中执行状态已操作支付功能,不允许退回!");
			}else {
				r = yspTaskService.flowRefuse(bid, reason, userId);
			}
		}
		else if (menuId == MenuId.TCW_CompanyAccountTransfer.longValue()) {// 公司账户资金转账
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_NeedPayAccountPay.longValue()) {// 应付账户支付
			r = tcwNeedPayAccountPayService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_EntryApply.longValue()) {// 入账申请单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliPrepaymentRecorded.longValue()) {//万里汇预付款入账单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliSupplementary.longValue()) {//万里汇补账单
			r = tcwWanliSupplementaryService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliReconciliation.longValue()) {//万里汇预付款对账单
			r = tcwWanliReconciliationService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_RoleCostApply.longValue()) {//职能费用申请
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_PaymentApply.longValue()) {//付款申请单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_ExpenseSettleReturn.longValue()) {//费用结算返还单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseContract.longValue()) {//采购合同单
			r = tcgPurchaseContractService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchasePreStorage.longValue()) {//采购预入库
			r = tcgPurchasePreStorageService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseAppointOrder.longValue()) {//预约采购单
			TcgPurchaseAppointOrder entity = new TcgPurchaseAppointOrder().setBid(bid).queryFirst();
			r = tcgPurchaseAppointOrderService.flowRefuse(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TCG_PurchasePayment.longValue()) {//采购付款单
			r = tcgPurchasePaymentService.flowRefuse(bid,reason, userId);
		}
		else if (menuId == MenuId.TCG_InvoiceOffset.longValue()) {//发票预核销单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_InvoiceRegist.longValue()) {//发票登记单
			r = tcgInvoiceRegistService.flowRefuse(bid, reason,userId);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation.longValue()) {//费用划拨单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_ExpenseSettlement.longValue()) {//费用结算单
			r = yspTaskService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TL_CustomsDeclaration.longValue()) {//报关单
			r = tlCustomsDeclarationService.flowRefuse(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseByPlan.longValue()) {//采购计划单
			r = tcgPurchasePlanService.flowRefuse(bid, reason,userId);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation_ByManage.longValue()) {//费用划拨单（管理）
			r = yspTaskService.flowRefuse(bid, reason,userId);
		}
		else {
			r = R.error("手机端尚未配置该单据");
		}
		return r;
	}



    /**
     * 审核驳回
     */
    @Override
    public R taskFlowInit(Long menuId,String userId,String bid, String reason) throws Exception{
        R r = R.ok();
        /*
         * 根据不同菜单ID，退回不同单据
         */
		if (menuId == MenuId.THR_OperateCompanyBeian.longValue()) {// 运营公司备案
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_RunningBack.longValue()) {// 费用返还单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.ADM_UseSignetApply.longValue()) {// 用章申请单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TP_AplusSq.longValue()) {// A+申请
			TpAplusSq entity = new TpAplusSq().setBid(bid).queryFirst();
			r = tpAplusSqService.flowInit(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TP_ProductActiveSq.longValue()) {// Listing申请
			TpProductActiveSq entity = new TpProductActiveSq().setBid(bid).queryFirst();
			r = tpProductActiveSqService.flowInit(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TCC_Allocate.longValue()) {// 预约调拨单
			TccAllocate entity = new TccAllocate().setBid(bid).queryFirst();
			r = tccAllocateService.flowInit(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TP_ProductBq.longValue()) {// 商品备案申请
			TpProductBq entity = new TpProductBq().setBid(bid).queryFirst();
			r = tpProductBqService.flowInit(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.THR_UserEntryApply.longValue()) {// 员工入职申请
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCC_Distribute.longValue()) {// 手工分配单
			TccDistribute entity = new TccDistribute().setBid(bid).queryFirst();
			r = tccDistributeService.flowInit(entity.getId(), reason, userId);
		}
		else if (menuId == MenuId.TCC_AllocateCancel.longValue()) {// 预约调拨取消单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.THR_CanvassApply.longValue()) {// 招商信息申请
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockIn.longValue()) {// 物料入库单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.THR_TransparencyProgram.longValue()) {// 透明计划申报
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TB_UserMonthPerformanceReport.longValue()) {// 员工月度绩效申报
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockOut.longValue()) {// 物料出库单
			TwlStockOut entity = new TwlStockOut().setBid(bid).queryFirst();
			r = twlStockOutService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_UserPayApply.longValue()) {// 员工工资申请单
			TbUserPayApply entity = new TbUserPayApply().setBid(bid).queryFirst();
			r = tbUserPayApplyService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_PayrollSlip.longValue()) {// 工资付款单
			TbPayrollSlip entity = new TbPayrollSlip().setBid(bid).queryFirst();
			r = tbPayrollSlipService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_MedicarePay.longValue()) {// 医保付款单
			TbMedicarePay entity = new TbMedicarePay().setBid(bid).queryFirst();
			r = tbMedicarePayService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_SocialSecurityPay.longValue()) {// 社保付款单
			TbSocialSecurityPay entity = new TbSocialSecurityPay().setBid(bid).queryFirst();
			r = tbSocialSecurityPayService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_ReservedPay.longValue()) {// 公积金付款单
			TbReservedPay entity = new TbReservedPay().setBid(bid).queryFirst();
			r = tbReservedPayService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.TB_IncomePay.longValue()) {// 个税付款单
			TbIncomePay entity = new TbIncomePay().setBid(bid).queryFirst();
			r = tbIncomePayService.flowInit(entity.getId(), reason,userId);
		}
		else if (menuId == MenuId.THR_VatApply.longValue()) {// VAT申报
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockTransfer.longValue()) {// 物料转移单
			r = twlStockTransferService.flowInit(bid, reason,userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountBack.longValue()) {// 预支账户归还单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountRecharge.longValue()) {// 预支账户充值单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountReimbursement.longValue()) {// 预支账户报销单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TWL_StockBorrow.longValue()) {// 物料借用单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_CapitalRegister.longValue()) {// 资金登记单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_CapitalBusinessCost.longValue()) {// 预付款认领单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_CapitalClaim.longValue()) {// 资金认领单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliCurrencyExchange.longValue()) {// 万里汇货币兑换单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliDrawing.longValue()) {// 万里汇提款单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_PaymentReturn.longValue()) {// 预付款退回申请
			TcwPaymentReturn entity = new TcwPaymentReturn().setBid(bid).queryFirst();
			r = tcwPaymentReturnService.flowInit(entity.getId(),  reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliCnyPayment.longValue()) {// 万里汇CNY付款单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliPrepaymentRecorded.longValue()) {//万里汇预付款入账单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliOtherPayment.longValue()) {// 万里汇外币付款单
			r = tcwWanliOtherPaymentService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliPaymentReturn.longValue()) {//万里汇预付款退回
			//是否有支付过的数据 不允许回退
			if (new TcwWanliPaymentReturnItem().setWanliPaymentReturnBid(bid).where("A.statePay = 1 OR A.statePay = 2").count() != 0){
				return R.error("数据中执行状态已操作支付功能,不允许驳回!");
			}else {
				r = yspTaskService.flowInit(bid, reason, userId);
			}
		}
		else if (menuId == MenuId.TCW_CompanyAccountTransfer.longValue()) {// 公司账户资金转账
            r = yspTaskService.flowInit(bid, reason, userId);
        }
		else if (menuId == MenuId.TCW_EntryApply.longValue()) {// 入账申请单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliSupplementary.longValue()) {//万里汇补账单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_WanliReconciliation.longValue()) {//万里汇预付款对账单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_RoleCostApply.longValue()) {//职能费用申请
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_NeedPayAccountPay.longValue()) {// 应付账户支付
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_PaymentApply.longValue()) {//付款申请单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_ExpenseSettleReturn.longValue()) {//费用结算返还单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseContract.longValue()) {//采购合同单
			r = tcgPurchaseContractService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchasePreStorage.longValue()) {//采购预入库
			r = tcgPurchasePreStorageService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseAppointOrder.longValue()) {//预约采购单
			TcgPurchaseAppointOrder entity = new TcgPurchaseAppointOrder().setBid(bid).queryFirst();
			r = tcgPurchaseAppointOrderService.flowInit(entity.getId(),reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchasePayment.longValue()) {//采购付款单
			r = tcgPurchasePaymentService.flowInit(bid,reason, userId);
		}
		else if (menuId == MenuId.TCG_InvoiceOffset.longValue()) {//发票预核销单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_InvoiceRegist.longValue()) {//发票登记单
			r = yspTaskService.flowInit(bid, reason,userId);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation.longValue()) {//费用划拨单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCW_ExpenseSettlement.longValue()) {//费用结算单
			r = yspTaskService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TL_CustomsDeclaration.longValue()) {//报关单
			r = tlCustomsDeclarationService.flowInit(bid, reason, userId);
		}
		else if (menuId == MenuId.TCG_PurchaseByPlan.longValue()) {//采购计划单
			r = tcgPurchasePlanService.flowInit(bid, reason,userId);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation_ByManage.longValue()) {//费用划拨单（管理）
			r = yspTaskService.flowRefuse(bid, reason,userId);
		}
		else {
            r = R.error("手机端尚未配置该单据");
        }
        return r;
    }


	/**
	 * 获取列表数据
	 */
	@Override
	public Map<String, Object> fromInfo(Long menuId, String bid) throws Exception{

		if(menuId == MenuId.THR_OperateCompanyBeian.longValue()) { //运营公司备案
			return thrOperateCompanyBeianService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_RunningBack.longValue()) {// 费用返还单
			Map<String, Object> entity = new TcwRunningBack().setBid(bid).queryFirstMap();
			return entity;
		}
		else if (menuId == MenuId.ADM_UseSignetApply.longValue()) {// 用章申请单
			Map<String, Object> entity = new AdmUseSignetApply().setBid(bid).queryFirstMap();
			return entity;
		}
		else if (menuId == MenuId.TP_AplusSq.longValue()) {// A+申请
			return tpAplusSqService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TP_ProductActiveSq.longValue()) {// Listing申请
			return tpProductActiveSqService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCC_Allocate.longValue()) {// 预约调拨单
			Map<String, Object>  entity = new TccAllocate().setBid(bid).queryFirstMap();
			return entity;
		}
		else if (menuId == MenuId.TP_ProductBq.longValue()) {// 商品备案申请
			return tpProductBqService.getExtraParam(bid);
		}
		else if (menuId == MenuId.THR_UserEntryApply.longValue()) {// 员工入职申请
			return thrUserEntryApplyService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCC_Distribute.longValue()) {// 手工分配单
			Map<String, Object> entity = new TccDistribute().setBid(bid).queryFirstMap();
			return entity;
		}
		else if (menuId == MenuId.TCC_AllocateCancel.longValue()) {// 预约调拨取消单
			return tccAllocateCancelService.getExtraParam(bid);
		}
		else if (menuId == MenuId.THR_CanvassApply.longValue()) {// 招商信息申请
			return thrCanvassApplyService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TWL_StockIn.longValue()) {// 物料入库单
			Map<String, Object> entity = new TwlStockIn().setBid(bid).queryFirstMap();
			return entity;
		}
		else if(menuId == MenuId.THR_TransparencyProgram.longValue()) { //透明计划申报
			return thrTransparencyProgramService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TB_UserMonthPerformanceReport.longValue()) {// 员工月度绩效申报
			return tbUserMonthPerformanceReportService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TWL_StockOut.longValue()) {// 物料出库单
			Map<String, Object> entity = new TwlStockOut().setBid(bid).queryFirstMap();
			return entity;
		}
		else if (menuId == MenuId.TB_UserPayApply.longValue()) {// 员工工资申请单
			return tbUserPayApplyService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TB_PayrollSlip.longValue()) {// 工资付款单
			return tbPayrollSlipService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TB_MedicarePay.longValue()) {// 医保付款单
			return tbMedicarePayService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TB_SocialSecurityPay.longValue()) {// 社保付款单
			return tbSocialSecurityPayService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TB_ReservedPay.longValue()) {// 公积金付款单
			return tbReservedPayService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TB_IncomePay.longValue()) {// 个税付款单
			return tbIncomePayService.getExtraParam(bid);
		}
		else if(menuId == MenuId.THR_VatApply.longValue()) { //VAT申报
			return thrVatApplyService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TWL_StockTransfer.longValue()) {// 物料转移单
			return twlStockTransferService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountBack.longValue()) {// 预支账户归还单
			return tcwAdvanceAccountBackService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountRecharge.longValue()) {// 预支账户充值单
			return tcwAdvanceAccountRechargeService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountReimbursement.longValue()) {// 预支账户报销单
			return tcwAdvanceAccountReimbursementService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TWL_StockBorrow.longValue()) {// 物料借用单
			return twlStockBorrowService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_CapitalRegister.longValue()) {// 资金登记单
			return tcwCapitalRegisterService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_CapitalBusinessCost.longValue()) {// 预付款认领单
			return tcwCapitalBusinessCostService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_CapitalClaim.longValue()) {// 资金认领单
			return tcwCapitalClaimService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliCurrencyExchange.longValue()) {// 万里汇货币兑换单
			return tcwWanliCurrencyExchangeService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliDrawing.longValue()) {// 万里汇提款单
			return tcwWanliDrawingService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_PaymentReturn.longValue()) {// 预付款退回申请
			return tcwPaymentReturnService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliCnyPayment.longValue()) {// 万里汇CNY付款单
			return tcwWanliCnyPaymentService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliPrepaymentRecorded.longValue()) {//万里汇预付款入账单
			return tcwWanliPrepaymentRecordedService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliOtherPayment.longValue()) {// 万里汇外币付款单
			return tcwWanliOtherPaymentService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliPaymentReturn.longValue()) {// 万里汇预付款退回
			return tcwWanliPaymentReturnService.getExtraParam(bid);
		}
		else if(menuId == MenuId.TCW_CompanyAccountTransfer.longValue()) { //公司账户资金转账
			return tcwCompanyAccountTransferService.getExtraParam(bid);
		}
		else if(menuId == MenuId.TCW_EntryApply.longValue()) { //入账申请单
			return tcwEntryApplyService.getExtraParam(bid);
		}
		else if(menuId == MenuId.TCW_NeedPayAccountPay.longValue()) { //应付账户支付
			return tcwNeedPayAccountPayService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliSupplementary.longValue()) {//万里汇补账单
			return tcwWanliSupplementaryService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_WanliReconciliation.longValue()) {//万里汇预付款对账单
			return tcwWanliReconciliationService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_RoleCostApply.longValue()) {//职能费用申请
			return tcwRoleCostApplyService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_PaymentApply.longValue()) {//付款申请单
			return tcwPaymentApplyService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseSettleReturn.longValue()) {//费用结算返还单
			return tcwExpenseSettleReturnService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_PurchaseContract.longValue()) {//采购合同单
			return tcgPurchaseContractService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_PurchasePreStorage.longValue()) {//采购预入库
			return tcgPurchasePreStorageService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_PurchaseAppointOrder.longValue()) {//预约采购单
			return tcgPurchaseAppointOrderService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_PurchasePayment.longValue()) {//采购付款单
			return tcgPurchasePaymentService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_InvoiceOffset.longValue()) {//发票预核销单
			return tcgInvoiceOffsetService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_InvoiceRegist.longValue()) {//发票登记单
			return tcgInvoiceRegistService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation.longValue()) {//费用划拨单
			return tcwExpenseAllocationService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseSettlement.longValue()) {//费用结算单
			return tcwExpenseSettlementService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TL_CustomsDeclaration.longValue()) {//报关单
			return tlCustomsDeclarationService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCG_PurchaseByPlan.longValue()) {//采购计划单
			return tcgPurchasePlanService.getExtraParam(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation_ByManage.longValue()) {//费用划拨单（管理）
			return tcwExpenseAllocationByManageService.getExtraParam(bid);
		}
		else {
			return new HashMap<>();
		}
	}


	/**
	 * 获取子列表数据
	 */
	@Override
	public List<Map<String, Object>> sonlist(Long menuId, String bid) throws Exception{

		if(menuId == MenuId.THR_TransparencyProgram.longValue()) { //透明计划申报
			return thrTransparencyProgramService.getItemList(bid);
		}
		else if (menuId == MenuId.TCC_Allocate.longValue()) {// 预约调拨单
			return tccAllocateService.getItemList(bid);
		}
		else if (menuId == MenuId.TP_ProductBq.longValue()) {// 商品备案申请
			TpProductBq entity = new TpProductBq().setBid(bid).queryFirst();
			List<Map<String, Object>> tpProductBqSqList = new TpProductBqSp()
					.setPid(Long.valueOf(entity.getId()))
					.queryMap();
			return tpProductBqSqList;
		}
		else if (menuId == MenuId.TCC_Distribute.longValue()) {// 手工分配单
			return tccDistributeService.getItemList(bid);
		}
		else if (menuId == MenuId.TCC_AllocateCancel.longValue()) {// 预约调拨取消单
			return tccAllocateCancelService.getItemList(bid);
		}
		else if (menuId == MenuId.THR_CanvassApply.longValue()) {// 招商信息申请
			return thrCanvassApplyService.getItemList(bid);
		}
		else if (menuId == MenuId.TWL_StockIn.longValue()) {// 物料入库单
			return twlStockInService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_UserMonthPerformanceReport.longValue()) {// 员工月度绩效申报
			return tbUserMonthPerformanceReportService.getItemList(bid);
		}
		else if (menuId == MenuId.TWL_StockOut.longValue()) {// 物料出库单
			return twlStockOutService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_UserPayApply.longValue()) {// 员工工资申请单
			return tbUserPayApplyService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_PayrollSlip.longValue()) {// 工资付款单
			return tbPayrollSlipService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_MedicarePay.longValue()) {// 医保付款单
			return tbMedicarePayService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_SocialSecurityPay.longValue()) {// 社保付款单
			return tbSocialSecurityPayService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_ReservedPay.longValue()) {// 公积金付款单
			return tbReservedPayService.getItemList(bid);
		}
		else if (menuId == MenuId.TB_IncomePay.longValue()) {// 个税付款单
			return tbIncomePayService.getItemList(bid);
		}
		else if(menuId == MenuId.THR_VatApply.longValue()) { //VAT申报
			return thrVatApplyService.getItemList(bid);
		}
		else if (menuId == MenuId.TWL_StockTransfer.longValue()) {// 物料转移单
			return twlStockTransferService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_AdvanceAccountReimbursement.longValue()) {// 预支账户报销单
			return tcwAdvanceAccountReimbursementService.getItemList(bid);
		}
		else if (menuId == MenuId.TWL_StockBorrow.longValue()) {// 物料借用单
			return twlStockBorrowService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_CapitalRegister.longValue()) {// 资金登记单
			return tcwCapitalRegisterService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_CapitalBusinessCost.longValue()) {// 预付款认领单
			return tcwCapitalBusinessCostService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_CapitalClaim.longValue()) {// 资金认领单
			return tcwCapitalClaimService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliCurrencyExchange.longValue()) {// 万里汇货币兑换单
			return tcwWanliCurrencyExchangeService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliDrawing.longValue()) {// 万里汇提款单
			return tcwWanliDrawingService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_PaymentReturn.longValue()) {// 预付款退回申请
			return tcwPaymentReturnService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliCnyPayment.longValue()) {// 万里汇CNY付款单
			return tcwWanliCnyPaymentService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliPrepaymentRecorded.longValue()) {//万里汇预付款入账单
			return tcwWanliPrepaymentRecordedService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliOtherPayment.longValue()) {// 万里汇外币付款单
			return tcwWanliOtherPaymentService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliPaymentReturn.longValue()) {// 万里汇预付款退回
			return tcwWanliPaymentReturnService.getItemList(bid);
		}
		else if(menuId == MenuId.TCW_CompanyAccountTransfer.longValue()) { //公司账户资金转账
			return tcwCompanyAccountTransferService.getItemList(bid);
		}
		else if(menuId == MenuId.TCW_EntryApply.longValue()) { //入账申请单
			return tcwEntryApplyService.getItemList(bid);
		}
		else if(menuId == MenuId.TCW_NeedPayAccountPay.longValue()) { //应付账户支付
			return tcwNeedPayAccountPayService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliSupplementary.longValue()) {//万里汇补账单
			return tcwWanliSupplementaryService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_RoleCostApply.longValue()) {//职能费用申请
			return tcwRoleCostApplyService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_PaymentApply.longValue()) {//付款申请单
			return tcwPaymentApplyService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_WanliReconciliation.longValue()) {//万里汇预付款对账单
			return tcwWanliReconciliationService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseSettleReturn.longValue()) {//费用结算返还单
			return tcwExpenseSettleReturnService.getItemList(bid);
		}
		else if (menuId == MenuId.TCG_PurchaseContract.longValue()) {//采购合同单
			return tcgPurchaseContractService.getItemListByBid(bid);
		}
		else if (menuId == MenuId.TCG_PurchasePreStorage.longValue()) {//采购预入库
			return tcgPurchasePreStorageService.getItemList(bid);
		}
		else if (menuId == MenuId.TCG_PurchaseAppointOrder.longValue()) {//预约采购单
			return tcgPurchaseAppointOrderService.getItemList(bid);
		}
		else if (menuId == MenuId.TCG_PurchasePayment.longValue()) {//采购付款单
			return tcgPurchasePaymentService.getItemList(bid);
		}
		else if (menuId == MenuId.TCG_InvoiceOffset.longValue()) {//发票预核销单
			return tcgInvoiceOffsetService.getItemList(bid);
		}
		else if (menuId == MenuId.TCG_InvoiceRegist.longValue()) {//发票登记单
			return tcgInvoiceRegistService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation.longValue()) {//费用划拨单
			return tcwExpenseAllocationService.getItemList(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseSettlement.longValue()) {//费用结算单
			return tcwExpenseSettlementService.getItemList(bid);
		}
		else if (menuId == MenuId.TL_CustomsDeclaration.longValue()) {//报关单
			return tlCustomsDeclarationService.getItemListByBid(bid);
		}
		else if (menuId == MenuId.TCG_PurchaseByPlan.longValue()) {//采购计划单
			return tcgPurchasePlanService.getItemListByBid(bid);
		}
		else if (menuId == MenuId.TCW_ExpenseAllocation_ByManage.longValue()) {//费用划拨单（管理）
			return tcwExpenseAllocationByManageService.getItemList(bid);
		}
		else {
			return new ArrayList<Map<String, Object>>();
		}
	}
}
